task.php assumes that $_SERVER[ 'argv' ][ 0 ] is a numeric ID of
a task to run. In actuality, it's the script that is being run
...
$:php task.php
ARGV == array ( 0 => 'task.php' )
Here is a replacement for the end of task.php which corrects
this, and add type checking
if( !empty( $VAR[ 'id' ] ) && is_numeric( $VAR[ 'id' ] )
) {
$task->id = $VAR[ 'id' ];
} else if( isset( $SERVER[ 'argv' ] ) && count(
$SERVER[ 'argv' ] ) > 1 && isset( $SERVER[
'argv' ][ 1 ] ) && is_numeric( $SERVER[ 'argv' ][ 1 ]
) ) {
$task->id = $_SERVER[ 'argv'][ 1 ];
}